@extends('layouts.mobile_main')

@section('title', '商家详情')

@section('resources')
    @parent
    <link rel="stylesheet" href="{{ env('CSS_DOMAIN') }}css/public.css?v={{env('CSS_VERSION')}}">
    <script src="{{env('JS_DOMAIN')}}/js/adaptation.js?v={{env('JS_VERSION')}}"></script>
    <style>
        body{padding-bottom: 1.6rem;}
    	.business_1{
    		height: 0.9rem;
    		line-height: 0.9rem;
    		padding-left: 1.3rem;
    		background: url({{env('IMAGE_DOMAIN')}}images/shop_store.png) 0.6rem 0.2rem no-repeat;
    		background-size: 0.48rem;
    		border-bottom: 1px solid #d6d7dc;
    	}
    	.business_num{width: 2.65rem;height: 1rem;margin-top: 0.4rem;line-height: 1rem;border-left: 1px solid #d6d7dc;padding-left: 2.15rem;background: url({{env('IMAGE_DOMAIN')}}images/shop_call.png) 1.1rem 0.1rem no-repeat;background-size: 0.8rem;}
    	.business_2 li:nth-child(3){background: url({{env('IMAGE_DOMAIN')}}images/location.png) 0.3rem 0.5rem no-repeat;background-size: 0.48rem;height: 1.38rem;line-height: 1.38rem;padding-left: 0.9rem;}
    	.consume_need_log{
    		background: url({{env('IMAGE_DOMAIN')}}images/shop_notice.png) 0.6rem 0.2rem no-repeat;
    		background-size: 0.48rem;
    		height: 0.8rem;line-height: 0.8rem;
    		padding-left: 1.3rem;
    		border-bottom: 1px solid #d6d7dc;
    	}
    	.nearby_business_log{
    		background: url({{env('IMAGE_DOMAIN')}}images/shop_nearby.png) 0.6rem 0.2rem no-repeat;
    		background-size: 0.48rem;
    		height: 0.8rem;line-height: 0.8rem;
    		padding-left: 1.3rem;
    		border-bottom: 1px solid #d6d7dc;
    	}
    	.business_time{
    		width: 23.3%;
    		background: #fff url({{env('IMAGE_DOMAIN')}}images/shop_calendar.png) 0.6rem 0.4rem no-repeat;
    		background-size: 0.9rem;
    		padding: 0.55rem 0 0.55rem 1.8rem;
    	}
    	/*.business_foot1 p:nth-child(2){
    		width: 32.7%;
    		background: #9955c6 url({{env('IMAGE_DOMAIN')}}images/shop_pay.png) 1.55rem 0.4rem no-repeat;
    		background-size: 0.9rem;
    		padding-left: 2.95rem;
    		padding-top: 0.55rem;
    	}*/
    	.business_foot2 a:nth-child(2){
    		width: 32.7%;
            height: 0.9rem;
    		background: #9955c6 url({{env('IMAGE_DOMAIN')}}images/shop_pay.png) 1.55rem 0.4rem no-repeat;
    		background-size: 0.9rem;
    		padding: 0.35rem 0 0.35rem 2.95rem;
    	}
    	.business_foot2 .business_foot3p{
    		background: #9955c6 url({{env('IMAGE_DOMAIN')}}images/shop_clock.png) 1.55rem 0.4rem no-repeat;
    		background-size: 0.9rem;
    		padding: 0.3rem 1.31rem 0.5rem 2.95rem;
    	}
        .busy_phone{
            height: 1rem;
            border-top: 0.2rem solid #eee;
        }
        .busy_phone a{
            float: left;
            height: 1rem;
            width: 9.55rem;
            line-height: 1rem;
            background: url({{env('IMAGE_DOMAIN')}}images/shop_phone.png) 0 0.3rem no-repeat;
            background-size: 0.48rem;
            font-size: 0.4rem;
            margin-left: 0.6rem;
            padding-left: 0.65rem;
        }
        .subscribe_outer{width: 100%;background: rgba(0,0,0,0.5);position: fixed;top: 0;left: 0;z-index: 20000;height: 1010px;}
        .subscribe_inner{position: absolute;bottom: 0;height: 5.5rem;background-color: #fff;width: 100%;padding-top: 0.5rem;}
        .subscribe_btn{position: absolute;bottom: 0;left: 0;width: 100%;height: 1.5rem;border-top: 1px solid #ccc;}
        .subscribe_btn span{width: 5.35rem;text-align: center;line-height: 1.5rem;}
        .shop_name{display: inline-block;max-width: 7.2rem;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;}
        .local_dizhi{margin-top: 0.2rem;background: url({{env('IMAGE_DOMAIN')}}images/shop_location.png) 0.6rem 0 no-repeat;background-size: 0.48rem;padding: 0 0.6rem 0.2rem 1.2rem;}
        #download{position: fixed;bottom: 1.6rem;right: 0;width: 100%;height: 1.6rem;background: rgba(172,125,204,0.8);}
        #download .down_close{position: absolute;top: -0.6rem;left: 0;width: 0.75rem;}
        #download .down_logo{width: 1.2rem;float: left;margin-left: 0.6rem;margin-top: 0.2rem;}
        #download p{float: left;margin-left: 0.6rem;overflow: hidden;width: 3rem;}
        #download span{float: left;}
        #download .down_down img{width: 2.5rem;float: left;height: 1rem;}
        .sharefor{width: 100%;background: rgba(0,0,0,0.5);position: fixed;top: 0;left: 0;z-index: 100;display: none;}
        .sharefor img{width: 100%;}
    </style>
@endsection

@section('content')
    <nav class="sharefor">
        <img src="{{env('IMAGE_DOMAIN')}}images/share.png" alt="">
    </nav>
    <header class="details_header">
    	<a class="fl" href="javascript:history.go(-1);">
    	    <img class="fl shop_back" src="{{env('IMAGE_DOMAIN')}}images/shop_back.png?v={{env('IMAGE_VERSION')}}" alt="">
    	</a>
    	<p class="fl tc co_violet fz_50"><span class="shop_name" style="display:none;">{{$name}}</span></p>

    	@if($collectionstatus)
            <img class="fl shop_collection_empty" src="{{env('IMAGE_DOMAIN')}}images/shop_collection_empty.png" alt="">
    	@else
            <img class="fl shop_collection_empty" src="{{env('IMAGE_DOMAIN')}}images/shop_collection_enter.png" alt="">
        @endif
        <img style="margin-left: 0.6rem;" class="fl shop_share" src="{{env('IMAGE_DOMAIN')}}images/shop_share.png" alt="">
    </header>
    <!-- 商家图片 -->
    <a href="/mobile/shop/bigpicture?shopid={{$shopid}}&page=1">
        <p class="business_pic pr">
            <img class="fl" src="{{env('IMAGE_DOMAIN')}}{{$logo}}" alt="">
            <span class="fz_36 co_white">{{count($photoarray)}}张图</span>
        </p>
    </a>
    @if(count($goodphotoarray))
    <!-- 商家食物图 -->
    <div class="food_pic">
    	<ul>
    	@foreach($goodphotoarray as $list)
            <a href="/mobile/shop/bigpicture?shopid={{$shopid}}&page={{count($photoarray)+2}}">
    		<li>
    			<img src="{{env('IMAGE_DOMAIN')}}{{$list['url']}}" alt="">
    			<p>{{$list['name']}}</p>
    		</li>
    		</a>
    	@endforeach
    	</ul>
    </div>
    @endif
    <!-- 商家信息 -->
    <section class="business_xinxi">
    	<p class="fz_40 business_1 co_violet">商家信息</p>
    	<ul class="oh business_2">
    		<li class="busy_namexiao">
    			<h1 class="fz_50 fl" style="margin-left: 0.6rem;">{{$name}}</h1>
    			<!-- <p class="fz_40 co_gray fr" style="margin-right: 0.6rem;">{{$ordernumber}}笔消费</p> -->
    		</li>
    		<li class="oh">
    			<div class="fl">
    				<p class="star_scrol oh" style="height: 0.5rem;">
    				    @if($commentmark <=1)
    					    <img src="{{env('IMAGE_DOMAIN')}}images/half.png" alt="">
    					    <img src="{{env('IMAGE_DOMAIN')}}images/empty.png" alt="">
    					    <img src="{{env('IMAGE_DOMAIN')}}images/empty.png" alt="">
    					    <img src="{{env('IMAGE_DOMAIN')}}images/empty.png" alt="">
    					    <img src="{{env('IMAGE_DOMAIN')}}images/empty.png" alt="">
    					@elseif(($commentmark>1) && ($commentmark <=2))
    					    <img src="{{env('IMAGE_DOMAIN')}}images/enter.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/empty.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/empty.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/empty.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/empty.png" alt="">
    					@elseif(($commentmark>2) && ($commentmark <=3))
    					    <img src="{{env('IMAGE_DOMAIN')}}images/enter.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/half.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/empty.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/empty.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/empty.png" alt="">
    					@elseif(($commentmark>3) && ($commentmark <=4))
    					    <img src="{{env('IMAGE_DOMAIN')}}images/enter.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/enter.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/empty.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/empty.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/empty.png" alt="">
    					@elseif(($commentmark>4) && ($commentmark <=5))
    					    <img src="{{env('IMAGE_DOMAIN')}}images/enter.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/enter.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/half.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/empty.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/empty.png" alt="">
    					@elseif(($commentmark>5) && ($commentmark <=6))
    					    <img src="{{env('IMAGE_DOMAIN')}}images/enter.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/enter.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/enter.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/empty.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/empty.png" alt="">
    					@elseif(($commentmark>6) && ($commentmark <=7))
    					    <img src="{{env('IMAGE_DOMAIN')}}images/enter.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/enter.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/enter.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/half.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/empty.png" alt="">
    					@elseif(($commentmark>7) && ($commentmark <=8))
    					    <img src="{{env('IMAGE_DOMAIN')}}images/enter.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/enter.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/enter.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/enter.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/empty.png" alt="">
    					@elseif(($commentmark>8) && ($commentmark <=9))
    					    <img src="{{env('IMAGE_DOMAIN')}}images/enter.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/enter.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/enter.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/enter.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/half.png" alt="">
    					@elseif(($commentmark>9) && ($commentmark <=10))
    					    <img src="{{env('IMAGE_DOMAIN')}}images/enter.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/enter.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/enter.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/enter.png" alt="">
                            <img src="{{env('IMAGE_DOMAIN')}}images/enter.png" alt="">
    					@endif
    					<span class="fz_34 co_star fl" style="margin-left: 0.2rem;margin-top: 0.1rem;">{{$commentmark}}</span>
    				</p>
    				<a href="/mobile/shop/comment/list?shopid={{$shopid}}&type=0">
    				    <p class="fz_40 co_gray" style="margin-top:0.3rem;margin-left: 1rem;"><span>{{$commentnumber}}次评价</span>
    				    <img style="width: 0.48rem;position: relative;top: 0.1rem;" src="{{env('IMAGE_DOMAIN')}}images/go_g.png?v={{env('IMAGE_VERSION')}}" alt=""></p>
    				</a>
    			</div>
    			<p class="fz_48 co_gray fr business_num">
    			<a href="tel:{{$contactnumber}}">联系商家</a></p>
    		</li>
    		<a href="/mobile/shop/map?shopid={{$shopid}}&address={{$address}}&name={{$name}}"><li class="fz_36 co_gray local_dizhi">地址：{{$address}}</li></a>
    		<li>
    			<p class="fz_36">营业时间</p>
    			<p style="margin: 0.25rem 0;" class="fz_34 co_gray">{{$businesshours}}</p>
    			<p class="fz_36 shop_synopsis">商家简介</p>
    			<p style="margin-top: 0.25rem;padding-right: 0.6rem;" class="fz_34 co_gray synopsis_text">{{$description}}</p>
    		</li>
    	</ul>
    </section>
    <!-- 消费须知 -->
    <section class="consume_need">
    	<p class="consume_need_log fz_44 co_violet">消费须知</p>
    	<div class="consume_need_text">
    		<p class="fz_36">消费范围</p>
    		<p class="fz_34 co_gray">{{$payinfo}}</p>
            @if(isset($content))
            <p class="fz_36">其他</p>
            <p class="fz_34 co_gray">{{$content}}</p>
            @endif
    		<p class="fz_36">发票</p>
    		<p class="fz_34 co_gray">{{$invoice}}</p>
    		@if(isset($tips))
    		<p class="fz_36">温馨提示</p>
    		<p class="fz_34 co_gray">{{$tips}}</p>
    		@endif
    	</div>
    </section>
    <section class="busy_phone">
        <a href="tel:4006989820">投诉商家</a>
    </section>
    <!-- 附近商家 -->
    <section class="nearby_business">
    	<p class="nearby_business_log fz_44 co_violet">附近商家</p>
    	<div class="nearby_business_pic oh">
    	@foreach($nearshop as $nearshoplist)
    		<a href="/mobile/shop/get?shopid={{$nearshoplist['shopid']}}&cityid={{$cityid}}&mylongitude={{$mylongitude}}&mylatitude={{$mylatitude}}">
    			<img src="{{env('IMAGE_DOMAIN')}}{{$nearshoplist['logo']}}" alt="">
    			<p class="fz_44 co_white tc">{{$nearshoplist['name']}}</p>
    		</a>
    	@endforeach
    	</div>
    </section>
    <!-- 尾部 -->
    <!-- <footer class="business_foot1 business_foot">
    	<p class="fl business_time fz_48 co_violet">翻倍日历</p>
    	<p class="fl fz_48 co_white">消费买单</p>
    </footer> -->
    <!-- <footer class="business_foot1 business_foot">
    	<p class="fl business_time fz_48 co_violet">翻倍日历</p>
    	<p class="fl fz_36 co_white">最近翻倍日<br><span>2.16-08-12</span></p>
    </footer> -->
    <footer class="business_foot2 business_foot">
        @if($shopstatus == 1)
            @if($todayevent||$nightevent)
                <a class="business_time fl" href="/mobile/shop/event?shopid={{$shopid}}"><p class="fl fz_48 co_violet">翻倍日历</p></a>
                <a href="/mobile/wallet/pay/shopin?shopid={{$shopid}}&shopname={{$name}}&address={{$address}}&payinfo={{$payinfo}}"><p id="wallet_recharge" class="fl fz_36 co_white" style="line-height: 0.9rem;">消费买单</p></a>
            @else
                <a class="business_time fl" href="/mobile/shop/event?shopid={{$shopid}}"><p class="fl fz_48 co_violet">翻倍日历</p></a>
                <a class="day_next" href="#"><p class="fl fz_36 co_white">最近翻倍日<br><span style="color: #fff;margin-left: 0;">{{date('Y-m-d', strtotime($nextevent))}}</span></p></a>
            @endif
        @else
            <p style="color: #9955c6;text-align: center;line-height: 1.6rem;font-size: 0.6rem;">该商家暂不支持买单</p>
        @endif
    </footer>
    <div class="subscribe_outer" hidden>
        <div class="subscribe_inner">
            <h3 class="fz_50 tc">{{$name}}</h3>
            <input type="hidden" name="shopid" value="{{$shopid}}" />
            <input type="hidden" name="auth" value="{{$auth}}" />
            <p class="fz_44 tc" style="margin-top: 0.2rem;">地址：{{$address}}</p>
            <p class="fz_44 tc co_violet" style="margin-top: 0.2rem;">添加订阅提醒，商家支持翻贝网代付时，</p>
            <p class="fz_44 tc co_violet">我们会第一时间通知您O(^O^)O</p>
            <p class="subscribe_btn">
                <span class="fl fz_44 co_gray subscribe_cancel" style="border-right: 1px solid #ccc;">取消</span>
                <span class="fl fz_44 co_violet subscribe_sure">确定</span>
            </p>
        </div>
    </div>
    <nav id="download">
        <img class="down_close" src="{{env('IMAGE_DOMAIN')}}images/index_close.png?v={{env('IMAGE_VERSION')}}" alt="">
        <img class="down_logo" src="{{env('IMAGE_DOMAIN')}}images/index_logo.png?v={{env('IMAGE_VERSION')}}" alt="">
        <p>
            <span class="fz_48 co_white" style="margin-top: 0.2rem;">翻贝网App</span>
            <span class="fz_40 co_white">翻贝网·翻倍花</span>
        </p>
        <a class="down_down" href="/mobile/app/download" style="float: right;margin-top: 0.3rem;margin-right: 0.6rem;"><img src="{{env('IMAGE_DOMAIN')}}images/index_download.png?v={{env('IMAGE_VERSION')}}" alt=""></a>
    </nav>
@endsection

@section("scriptResources")
    @parent
    <script>
        if(navigator.userAgent=='FBWAndroidApp'||navigator.userAgent.indexOf('FBWiOSApp')>0){
            $('header').hide();
            $('#download').hide();
        }else{
            $('header').show();
            $('#download').show();
        }
        window.onresize=function(){
        		pagesp();
        }
        $(".down_close").click(function(){
            $("#download").hide();
        })
        $('.subscribe_outer').height($(window).height());
        $('.sharefor').height($(window).height());
        $(".shop_share").click(function(){
            $('.sharefor').show();
            $('.sharefor').click(function(){
                $('.sharefor').hide();
            })
        });
        $(".day_next").click(function(){
           $('.subscribe_outer').show(); 
        });
        $(".subscribe_cancel").click(function(){
           $('.subscribe_outer').hide(); 
        });
        $(".subscribe_sure").click(function(){
            //alert("已加入订阅")
            var auth=$("input[name='auth']").val();
            var shopid=$("input[name='shopid']").val();
            if(auth == '0') {
                window.location.href="/mobile/login";
            } else {
                 $.ajax({
                    url : "/mobile/mycenter/subscription/add",
                    type: 'get',
                    data: {shopid:shopid},
                    dataType:'json',
                    success:function(data){
                        if(data.status=='success') {
                            $('.subscribe_outer').hide();
                            alert("已加入订阅")
                        } else {
                            alert("订阅失败");
                        }
                    }
                });
            }

        });
        if($('.nearby_business_pic').children().length==0){
            $('.nearby_business').hide();
        }else{
            $('.nearby_business').show();
        }
        var imgwidth=$(".food_pic ul li").width()+11;
        var imglength=$(".food_pic ul li").length;
        $(".food_pic ul").width(imgwidth*imglength);
        var notice=false;
        if(notice){
            $(".shop_collection_empty").attr("src","{{env('IMAGE_DOMAIN')}}images/shop_collection_enter.png");
        }else{
            $(".shop_collection_empty").attr("src","{{env('IMAGE_DOMAIN')}}images/shop_collection_empty.png");
        };
        $(".shop_collection_empty").click(function(){
            var sc=$(document).scrollTop();
            var search_h=$(".details_header").height();
            var shopid = "{{$shopid}}";
            var auth = "{{$auth}}";
            if(notice){
                if(sc<=search_h){
                    $(".shop_collection_empty").attr("src","{{env('IMAGE_DOMAIN')}}images/shop_collection_empty.png");
                }else{
                    $(".shop_collection_empty").attr("src","{{env('IMAGE_DOMAIN')}}images/shop_collection_empty_w.png");
                }
                notice=false;
                if(auth == '1') {
                    $.ajax({
                        url:"/mobile/mycenter/collection/delete",
                        data:{'shopid':shopid},
                        async:false
                    });
                } else {
                    window.location.href = '/mobile/login';
                }
            }else{
                if(sc<=search_h){
                    $(".shop_collection_empty").attr("src","{{env('IMAGE_DOMAIN')}}images/shop_collection_enter.png");
                }else{
                    $(".shop_collection_empty").attr("src","{{env('IMAGE_DOMAIN')}}images/shop_collection_enter_w.png");
                }
                notice=true;
                if(auth == '1') {
                    $.ajax({
                        url:"/mobile/mycenter/collection/add",
                        data:{'shopid':shopid},
                        async:false
                    });
                } else {
                    window.location.href = '/mobile/login';
                }
            }
        });
        $(window).scroll(function(){
            var hh=$(document).height();
            var wh=$(window).height();
            var sc=$(document).scrollTop();
            var search_h=$(".details_header").height();
            var opa=0;
            if(sc<=search_h){
                $(".details_header p span").hide();
                opa=sc/search_h;
                $(".details_header").css({"background":"rgba(255,255,255,"+opa+")","border-bottom":"none"});
                $(".shop_back").attr("src","{{env('IMAGE_DOMAIN')}}images/shop_back.png");
                $(".shop_share").attr("src","{{env('IMAGE_DOMAIN')}}images/shop_share.png");
                if(notice){
                    $(".shop_collection_empty").attr("src","{{env('IMAGE_DOMAIN')}}images/shop_collection_enter.png");
                }else{
                    $(".shop_collection_empty").attr("src","{{env('IMAGE_DOMAIN')}}images/shop_collection_empty.png");
                }
            }else{
                $(".details_header p span").show();
                $(".details_header").css({"background":"rgba(255,255,255,1)","border-bottom":"1px solid #9a54c6"});
                $(".shop_back").attr("src","{{env('IMAGE_DOMAIN')}}images/back_p.png");
                $(".shop_share").attr("src","{{env('IMAGE_DOMAIN')}}images/shop_share_w.png");
                if(notice){
                    $(".shop_collection_empty").attr("src","{{env('IMAGE_DOMAIN')}}images/shop_collection_enter_w.png");
                }else{
                    $(".shop_collection_empty").attr("src","{{env('IMAGE_DOMAIN')}}images/shop_collection_empty_w.png");
                }
            }
        })
        if($('.synopsis_text').html()==''){
            $('.shop_synopsis').hide();
        };
        
    </script>
@endsection